package de.baumann.browser.activitys.center

import android.content.Context
import android.content.Intent
import de.baumann.browser.R
import de.baumann.browser.api.net.vo.OdinWithdrawRecord
import de.baumann.browser.base.BaseOdinActivity
import de.baumann.browser.base.BasePresenter
import de.baumann.browser.iview.IBaseView
import kotlinx.android.synthetic.main.activity_withdraw_detail.*
import kotlinx.android.synthetic.main.include_tool_bar.*

/**
 *@author:
 *@date:2019/7/12 20:08
 *@discription: 提现详情
 */

@Deprecated("废弃")
class WithdrawDetailActivity : BaseOdinActivity<IBaseView,BasePresenter<IBaseView>>() {

    companion object {
        fun startWithdrawDetailActivity(context: Context, withdrawRecord: OdinWithdrawRecord) {
            val intent = Intent(context, WithdrawDetailActivity::class.java).apply {
                putExtra("withdrawRecord", withdrawRecord)
            }
            context.startActivity(intent)
        }
    }

    override fun getLayout(): Int {
        return R.layout.activity_withdraw_detail
    }

    override fun initView() {
        initToolbar(commToolBar,commTitle)
    }

    override fun getTitleText(): String {
        return getString(R.string.withdrawal_details)
    }

    override fun createPresenter(): BasePresenter<IBaseView>? {
        return null
    }

    override fun createView(): IBaseView? {
        return null
    }

    override fun initData() {
        val withdrawRecord = intent.getSerializableExtra("withdrawRecord") as OdinWithdrawRecord
        setWithdrawDetailCount(withdrawRecord.profit)
        setWithdrawDetailId(withdrawRecord.id)
        if (withdrawRecord.finishDate != null) {
            setWithdrawFinshTime(withdrawRecord.finishDate)
        }
        setWithdrawDetailPoundage(withdrawRecord.poundage)
        setWithdrawDetailTransferAmount(withdrawRecord.transferAmount)
        setWithdrawDetailAccount(withdrawRecord.ethAddress)
    }

    private fun setWithdrawDetailCount(count: String) {
        tvWithdrawDetailCount.text = count
    }

    private fun setWithdrawDetailId(id: String) {
        tvWithdrawDetailId.text = id
    }

    private fun setWithdrawFinshTime(finshTime: String) {
        tvWithdrawFinshTime.text = finshTime
    }

    private fun setWithdrawDetailPoundage(poundage: String) {
        tvWithdrawDetailPoundage.text = poundage
    }

    private fun setWithdrawDetailTransferAmount(transferAmount: String) {
        tvWithdrawDetailTransferAmount.text = transferAmount
    }

    private fun setWithdrawDetailAccount(account: String) {
        tvWithdrawDetailAccount.text = account
    }
}
